home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Proxies / SimpleConstProxy.h < prev    next >
Text File  |  1997-06-28  |  638b  |  38 lines

  1. // SimpleConstProxy.h
  2.  
  3. #ifndef SimpleConstProxy_h
  4. #define SimpleConstProxy_h
  5.  
  6. #ifndef Assert_h
  7. #include "Assert.h"
  8. #endif
  9. #ifndef ConstProxy_h
  10. #include "ConstProxy.h"
  11. #endif
  12.  
  13. template < class OwnerType, class StoodFor >
  14. class SimpleConstProxy: public ConstProxy< StoodFor >
  15.   {
  16.     typedef OwnerType Owner;
  17.     typedef StoodFor (Owner::*Getter)() const;
  18.     
  19.     private:
  20.         const Owner& owner;
  21.         const Getter get;
  22.     
  23.     public:
  24.         SimpleConstProxy( const Owner& theOwner, Getter getter )
  25.           : owner( theOwner ),
  26.              get( getter )
  27.           {
  28.             Assert( getter != 0 );
  29.           }
  30.         
  31.         virtual StoodFor Get() const
  32.           {
  33.             return (owner.*get)();
  34.           }
  35.   };
  36.  
  37. #endif
  38.